﻿using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MatrixWebApiCore.Common
{
    public class SysCoinfgData
    {
        /// <summary>
        /// 获取基金分析接口基地址
        /// </summary>
        public static string ApiBaesURL;
        /// <summary>
        /// 获取同类均值接口基地址
        /// </summary>
        public static string QuotesAPI;
        /// <summary>
        /// 配置文件连接字符串
        /// </summary>
        public static readonly string SqlServerConnetionString;
        /// <summary>
        /// 缓存存活时长
        /// </summary>
        public static readonly int MemoryCacheLiveTime;

        static SysCoinfgData()
        {
            var configBuilder = new ConfigurationBuilder().SetBasePath(AppDomain.CurrentDomain.BaseDirectory).AddXmlFile("config.xml");
            var configuration = configBuilder.Build();
            ApiBaesURL = configuration["common:dataSourceAPI"];
            QuotesAPI = configuration["common:quotesAPI"];
            SqlServerConnetionString = configuration["connectionStrings:DefaultConnection"];
            MemoryCacheLiveTime = Convert.ToInt32(configuration["common:cacheLiveTime"]);
        }


    }
}
